
    window.onload=function (ev) {

        //增加webSocket
        var webSocket=new WebSocket("ws://localhost:8080/websocket");

        if("webSocket" in window){
            console.log("客户端支持webSocket");
        }

        webSocket.onopen=function (event) {
            console.log("打开连接");
        };

        webSocket.onclose=function (ev) {
            console.log("断开连接")
        };

        //接受客户端信息
        webSocket.onmessage=function (ev) {
            console.log(ev.data);
            if(ev.data=="101"){
                alert("有用户登录你的账号,你已被迫下线,请及时修改密码!");
                window.location.href="/login.html";
            }
        };
        window.setInterval(function () {
            webSocket.send("11");

        },50000);

    };

